﻿using System.Windows.Controls.DataVisualization;
using System;
using System.Diagnostics;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Windows;

namespace ZipSpace
{
	public partial class ZipTreeMap : TreeMap
	{
        public event EventHandler<ItemEventArgs<ZipEntryView>> ItemSelected;

		public ZipTreeMap()
		{
			InitializeComponent();
		}

        private void Item_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            try
            {
                ZipEntryView view = null;

                FrameworkElement element = sender as FrameworkElement;
                if (element != null)
                {
                    view = element.DataContext as ZipEntryView;
                }

                this.ItemSelected(this, new ItemEventArgs<ZipEntryView>(view));
            }
            catch (Exception ex)
            {
                ExceptionWindow.Show(ex);
            }
        }
	}
}
